#ifndef __CONFIGURATION_HPP__
#define __CONFIGURATION_HPP__
#include <memory>
#include <string>
#include <map>
using std::unique_ptr;
using std::string;
using std::map;

namespace wd{

class Configuration{
    class AutoRelease{
    public:
        AutoRelease(){}
        ~AutoRelease(){
            if(_pinstance){
                delete _pinstance;
                _pinstance = nullptr;
            }
        }
    };
public:
    static Configuration* getInstance(const string & filepath);
    map<string,string> & getConfigMap();
private:
    Configuration(string filepath);
    ~Configuration(){}
    Configuration(const Configuration & ) = delete;
    Configuration& operator=(const Configuration&) = delete;

private:
    map<string,string> _map;
    static Configuration * _pinstance;
    static AutoRelease _ar;
};
}
#endif // __CONFIGURATION_HPP__
